package com.code.soulnetty.modbus.client.channel;

import java.net.InetSocketAddress;
import java.net.SocketAddress;

/**
 * @author lyf
 * @date 2022-12-17 15:40
 */
public class ProtocolUtils {
    public static String protocolKey(SocketAddress socketAddress) {
        if (socketAddress instanceof InetSocketAddress) {
            InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
            return inetSocketAddress.getAddress().getHostAddress() + ":" + inetSocketAddress.getPort();
        }
        return socketAddress.toString();
    }
}
